package com.itheima;

import java.util.Random;

public class TestLambda3 {
    public static void main(String[] args) {
        useRandomNumHandler(new RandomNumHandler() {
            @Override
            public int getNumhandler() {
                Random r=new Random();
                int num=r.nextInt(10)+1;
                return num;
            }
        });
        useRandomNumHandler(()->{
            Random r=new Random();
            int num=r.nextInt(10)+1;
            return num;
        });

    }
    public static void useRandomNumHandler(RandomNumHandler randomNumHandler){
        int a=randomNumHandler.getNumhandler();
        System.out.println(a);
    }
}
interface RandomNumHandler{
  int getNumhandler();
}